
/*
	REPLICATION OF TABLES FOR PAPER: "THE RISE AND PERSISTENCE OF ILLEGAL CROPS: EVIDENCE FROM A NAIVE POLICY ANNOUNCEMENT"
	Authors: Mounu Prem, Juan F. Vargas, and Daniel Mejía
*/

cls	
clear all 
set more off
set seed 11110


** Path to main folder
	global path "~/Dropbox/Research/Research Projects/Joint with Juan/Coca/Paper Replication/"
	
** Subfolders
	global Data 	"${path}Data/"
	global Figures 	"${path}Figures/"
	global Tables 	"${path}Tables/"

** Set tables folder
	cd "${Tables}"	
	
*****************************************************
** MAIN PAPER TABLES
*****************************************************	

************
// Table 1. Coca production, coca suitability, substitution probability, and policy announcement	
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	rename suit_announce T_announce
	label var T_announce "Treatment × Announcement"
	reghdfe coca_area_grid T_announce , absorb(muni_code year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_1 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, No, Controls, No)

    reghdfe coca_area_grid T_announce , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_1 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

    reghdfe coca_area_grid T_announce , absorb(muni_code year i.coddepto#i.year c.(indrural discapital IPM lpobl_tot)#i.announcement) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_1 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, Yes)
	rename T_announce suit_announce 
		
	xtset muni_code year	
	rename pr_PNIS_announce T_announce
	label var T_announce "Treatment × Announcement"
	
	xi: xtreg coca_area_grid T_announce i.year , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph  
		local se = _b[T_announce]/`r(t)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_1 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, (`se')) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, No, Controls, No)

	xi: xtreg coca_area_grid T_announce i.iddeptoy , fe vce(cl muni_code)	
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)   nograph 
		local se = _b[T_announce]/`r(t)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_1 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, (`se')) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	xi: xtreg coca_area_grid T_announce i.iddeptoy indrural_announce discapital_announce IPM_announce lpobl_tot_announce, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[T_announce]/`r(t)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_1 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, (`se')) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, Yes)	
	rename T_announce pr_PNIS_announce
	
	*** Conley SE: Need to check values
	reg2hdfespatial coca_area_grid suit_announce , timevar(year) panelvar(muni_code) lat(lat1) lon(lon1) distcutoff(279) lagcutoff(1)	

	xi: reg2hdfespatial coca_area_grid suit_announce i.iddeptoy , timevar(year) panelvar(muni_code) lat(lat1) lon(lon1) distcutoff(279) lagcutoff(1)	

	xi: reg2hdfespatial coca_area_grid suit_announce i.iddeptoy indrural_announce discapital_announce IPM_announce lpobl_tot_announce, timevar(year) panelvar(muni_code) lat(lat1) lon(lon1) distcutoff(279) lagcutoff(1)	
	
	reg2hdfespatial coca_area_grid pr_PNIS_announce , timevar(year) panelvar(muni_code) lat(lat1) lon(lon1) distcutoff(279) lagcutoff(1)	

	xi: reg2hdfespatial coca_area_grid pr_PNIS_announce i.iddeptoy , timevar(year) panelvar(muni_code) lat(lat1) lon(lon1) distcutoff(279) lagcutoff(1)	

	xi: reg2hdfespatial coca_area_grid pr_PNIS_announce i.iddeptoy indrural_announce discapital_announce IPM_announce lpobl_tot_announce, timevar(year) panelvar(muni_code) lat(lat1) lon(lon1) distcutoff(279) lagcutoff(1)	
	
	
************
// Table 2. Weather and altitude based coca suitability and within municipality analysis
************

	* Column 1
	* Load dataset
	use "${Data}MainData.dta", clear
		
	rename SDsuitability_weather_Ann T_announce
	label var T_announce "Treatment × Announcement"	
	xi: xtreg coca_area_grid T_announce  i.iddeptoy , fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) seed(11110) nograph 
		local se = _b[T_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_2 , tex(frag) replace bdec(3) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, (`se')) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, No, Controls, No)

	* Columns 2 and 3
	/*
	reghdfe COCA_C_ pred_rf_ann, abs(OBJECTID year year#muni_code) vce(cl muni_code)	
	
	reghdfe COCA_C_ pred_rf_ann if ever_coca == 1 , abs(OBJECTID year year#muni_code) vce(cl muni_code)	
	*/
	
************
// Table 3. Drug policy potential explanations
************

	* Load dataset
	use "${Data}MainData.dta", clear
		
	**** Panel A: Suitability
	label var suit_announce "Treatment × Announcement"
	* Baseline
	reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, No, Controls, No)

	* Control for eradication	
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.sh_eradication#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	* Places with no eradication	
    reghdfe coca_area_grid suit_announce if sh_eradication == 0, absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)	
	
	* Distance to airport
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.dist_min#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	* Number of airports
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.airportsR80#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	* Any airport
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.DairportsR80#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
		
	* Seizures	
    reghdfe coca_area_grid suit_announce coca_leaves coca_paste hydrochloride , absorb(muni_code i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
		
	* Lab destructions	
	reghdfe coca_area_grid suit_announce LabsDestuction, absorb(muni_code i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
		
		
	**** Panel B: Probability of substitution	
	label var pr_PNIS_announce "Treatment × Announcement"
	xtset muni_code year
	
	* Baseline
	xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, No, Controls, No)

	* Control for eradication	
	xi: xtreg coca_area_grid pr_PNIS_announce i.year*sh_eradication i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	* Places with no eradication
	xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy if sh_eradication == 0, fe vce(cluster muni_code)
        local N = `e(N_clust)'
 		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
       sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	* Distantce to airport
	xi: xtreg coca_area_grid pr_PNIS_announce i.year*dist_min i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	* Number of airports	
	xi: xtreg coca_area_grid pr_PNIS_announce i.year*airportsR80 i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)

	* Any airport
	xi: xtreg coca_area_grid pr_PNIS_announce i.year*DairportsR80 i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
		
	* Seizures	
    xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy coca_leaves coca_paste hydrochloride, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
		
	* Lab destructions	
    xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy LabsDestuction, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_3B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
	


************
// Table 4. Other potential alternative explanations
************

	* Load dataset
	use "${Data}MainData.dta", clear
		
	**** Panel A: Suitability
	label var suit_announce "Treatment × Announcement"
	
	* Baseline
	reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, No)
		
	* FARC	
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year FARC1#i.year ) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	* Distance to Venezuela and ocean
	reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.lndis_ven#i.year c.lndis_sea#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)

	* Other crops
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.ShaptaCacao#i.year c.ShaptaPalma#i.year c.cofint#i.year ) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)

	* Gold
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.gold_11#i.year c.shAUanomALT#i.year ) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
		
	* Social programs
    reghdfe coca_area_grid suit_announce , absorb(muni_code i.coddepto#i.year c.(avg_sh_beneficiaries_fest avg_sh_beneficiaries_iraca)#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
		
	* Deforestation
	reghdfe coca_area_grid suit_announce, absorb(muni_code i.coddepto#i.year c.sh_area_def_km2_05_13#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	 		
		
	**** Panel B: Probability of substitution	
	label var pr_PNIS_announce "Treatment × Announcement"
	xtset muni_code year
	
	* Baseline
	xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, No)
		
	* FARC	
	xi: xtreg coca_area_grid pr_PNIS_announce i.year*i.FARC1 i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	* Distance to venezuela and ocean
	xi: xtreg coca_area_grid pr_PNIS_announce i.year*lndis_ven i.year*lndis_sea i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	* Other crops
    xi: xtreg coca_area_grid pr_PNIS_announce i.year*ShaptaCacao i.year*ShaptaPalma i.year*cofint i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
		
	* Gold: gold_11 shAUanomMED shAUanomALT shAUanomMED_ALT
    xi: xtreg coca_area_grid pr_PNIS_announce i.year*gold_11 i.year*shAUanomALT i.iddeptoy , fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)		
	
	* Social programs
    xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy i.year*avg_sh_beneficiaries_fest i.year*avg_sh_beneficiaries_iraca, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	* Deforestation	
	xi: xtreg coca_area_grid pr_PNIS_announce i.iddeptoy i.year*sh_area_def_km2_05_13, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using Table_4B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes, Controls, No)
		

*****************************************************
** APPENDIX TABLES
*****************************************************	

************
// Table A.1. Summary Statistics
************
	* Load dataset
	use "${Data}MainData.dta", clear

	tabstat coca_area_grid , s(mean sd p50 p90 p10) c(s) format(%10.2f)
	tabstat coca_area_grid PNIS pr_PNIS indrural IPM discapital  pobl_tot if year < 2014, s(mean sd p50 p90 p10) c(s) format(%10.2f)

************
// Table A.2. Predicting PNIS
************
	* Load dataset
	use "${Data}MainData.dta", clear

	collapse IPM coca_area_grid PNIS  if year < 2014, by(muni_code)
	replace IPM = IPM/10
	
	label var IPM				"Poverty index"	
	label var coca_area_grid 	"Coca cultivation per 1,000 hct"		
	
	probit PNIS IPM coca_area_grid, vce(robust)
    sum PNIS 
    outreg2 using AppendixTable_2 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(IPM coca_area_grid) adds(Mean DV, r(mean)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, No, Controls, No)

************
// Table A.3. Relative importance of treatments
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	label var pr_PNIS_suit_announce	"Suitability × Probability of substitution × Announcement"
	label var suit_announce 		"Suitability × Announcement"
	label var pr_PNIS_announce 		"Probability of substitution × Announcement"
	
	xi: xtreg coca_area_grid suit_announce pr_PNIS_announce i.iddeptoy indrural_announce discapital_announce IPM_announce lpobl_tot_announce, fe vce(cl muni_code)	
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_3 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes, Controls, Yes)		
		
	xi: xtreg coca_area_grid pr_PNIS_suit_announce suit_announce pr_PNIS_announce i.iddeptoy indrural_announce discapital_announce IPM_announce lpobl_tot_announce, fe vce(cl muni_code)	
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'
		boottest pr_PNIS_suit_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se1 = _b[pr_PNIS_suit_announce]/`r(t)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_3 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_suit_announce suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se', Boot SE 3int, `se1') addtext(Municipality FE, Yes, Dept-Year FE, Yes, Controls, Yes)		

		
************
// Table A.4. Main results for using a longer series 2008 to 2018 and adding municipality level trends
************
	* Load dataset
	use "${Data}MainData_Long.dta", clear
	
	label var suit_announcement "Suitability × Announcement"
	
	reghdfe sh_coca suit_announcement , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code) 		
       local N = `e(N_clust)'
       sum sh_coca if e(sample) == 1 & year < 2014, d			
       outreg2 using AppendixTable_4 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announcement) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)		
	
	reghdfe sh_coca PNIS_announcement , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code) 			
       local N = `e(N_clust)'
       sum sh_coca if e(sample) == 1 & year < 2014, d			
       outreg2 using AppendixTable_4 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(PNIS_announcement) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)		
	
	reghdfe sh_coca suit_announcement , absorb(muni_code year c.trend#i.muni_code) vce(cluster muni_code) 		
       local N = `e(N_clust)'
       sum sh_coca if e(sample) == 1 & year < 2014, d			
       outreg2 using AppendixTable_4 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announcement) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes, Municipality trends, Yes)	

	reghdfe sh_coca PNIS_announcement , absorb(muni_code year c.trend#i.muni_code) vce(cluster muni_code) 			
       local N = `e(N_clust)'
       sum sh_coca if e(sample) == 1 & year < 2014, d			
       outreg2 using AppendixTable_4 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(PNIS_announcement) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes, Municipality trends, Yes)	 
	   
	   
************
// Table A.5. Robustness exercises
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	**** Coca suitability
	// Pre-trend
	label var trend_suit "Treatment × Trend"
	rename trend_suit trend_T
	reghdfe coca_area_grid trend_T if year < 2014, absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & announcement == 0, d			
        outreg2 using AppendixTable_5 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(trend_T) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename trend_T trend_suit
	
	// Placebo
	label var suitability_pla "Treatment × Announcement"
	rename suitability_pla T_announce
	reghdfe coca_area_grid T_announce  if year < 2014, absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & announcement == 0, d			
        outreg2 using AppendixTable_5 , tex(frag) bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename T_announce suitability_pla 
	
	// Collapse
	preserve
		collapse (mean) coca_area_grid suit_announce coddepto, by(muni_code announcement)
		rename suit_announce T_announce
		label var T_announce "Treatment × Announcement"
		reghdfe coca_area_grid T_announce , absorb(muni_code i.coddepto#i.announcement ) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & announcement == 0, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	restore
	
	// Machine learning controls	
	/*
	global vars "areaoficialkm2_announce altura_announce discapital_announce lpobl_tot_announce indrural_announce IPM_announce ind_alfa2005_announce desemp_fisc_announce y_corr_tribut_announce agua_announcement battalion_announcement erosion_announcement"
	
	xi: lassoShooting coca_area_grid $vars i.muni_code i.year, lasiter(100) verbose(0) fdisplay(0)
					
	local Y `r(selected)' 

	di "`Y'" 

	xi: lassoShooting suit_announce $vars i.muni_code i.year, lasiter(100) verbose(0) fdisplay(0)

	local X `r(selected)' 

	di "`X'" 

	local MLC : list Y | X 
	
	di "`MLC'" 	
	*/
	rename suit_announce T_announce
	label var T_announce "Treatment × Announcement"
	* Selected: altura_announcement IPM_announcement erosion_announcement
	reghdfe coca_area_grid T_announce altura_announcement IPM_announcement erosion_announcement , absorb(muni_code year i.coddepto#i.year ) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	
	// Weighted
	reghdfe coca_area_grid T_announce [aw=areaoficialkm2], absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename T_announce suit_announce 
	
	**** Probability of Substitution Program
	// Pre-trend
	label var trend_pr_PNIS "Treatment × Trend"
	rename trend_pr_PNIS trend_T
	xtset muni_code year 
	xi: xtreg coca_area_grid trend_T i.iddeptoy if year < 2014, fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest trend_T, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[trend_T]/`r(t)'	
        sum coca_area_grid if e(sample) == 1 & announcement == 0, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(trend_T) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename trend_T trend_pr_PNIS 

	// Placebo
	label var pr_PNIS_pla "Treatment × Announcement"
	rename pr_PNIS_pla T_announce
	xi: xtreg coca_area_grid T_announce i.iddeptoy if year < 2014, fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[T_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & announcement == 0, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename T_announce pr_PNIS_pla 		
	
	// Collapse
	preserve
		collapse (mean) coca_area_grid pr_PNIS_announce coddepto, by(muni_code announcement)
		label var pr_PNIS_announce "Treatment × Announcement"
		rename pr_PNIS_announce T_announce
		
		egen iddeptoan = group(coddepto announcement)
		xtset muni_code announcement
		xi: xtreg coca_area_grid T_announce i.iddeptoan , fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[T_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & announcement == 0, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)

	restore
	
	// Machine learning controls	
	/*
	global vars "areaoficialkm2_announce altura_announce discapital_announce lpobl_tot_announce indrural_announce IPM_announce ind_alfa2005_announce desemp_fisc_announce y_corr_tribut_announce"

	xi: lassoShooting coca_area_grid $vars i.muni_code i.year, lasiter(100) verbose(0) fdisplay(0)
					
	local Y `r(selected)' 

	di "`Y'" 

	xi: lassoShooting pr_PNIS_announce $vars i.muni_code i.year, lasiter(100) verbose(0) fdisplay(0)

	local X `r(selected)' 

	di "`X'" 

	local MLC : list Y | X 
	
	di "`MLC'" 	
	*/
	label var pr_PNIS_announce "Treatment × Announcement"
	rename pr_PNIS_announce T_announce
	* Selected: IPM_announcement
	xi: xtreg coca_area_grid T_announce IPM_announcement i.iddeptoy, fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[T_announce]/`r(t)'		
		sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)

	// Weighted
	xi: xtreg coca_area_grid T_announce i.iddeptoy [aw=areaoficialkm2], fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[T_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename T_announce pr_PNIS_announce 
	
	// PCA
	label var PrinComp_announce "Treatment × Announcement"
	rename PrinComp_announce T_announce
	xi: xtreg coca_area_grid T_announce i.iddeptoy , fe vce(cluster muni_code)
        local N = `e(N_clust)'
		boottest T_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[T_announce]/`r(t)'		
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_5 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(T_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	rename T_announce PrinComp_announce 

************
// Table A.6. Extension and new coca
************
	* Load dataset
	use "${Data}MainData.dta", clear

	xtset muni_code year
	label var suit_announce "Suitability × Announcement"
	label var pr_PNIS_announce "Probability of substitution × Announcement"
	
    reghdfe coca_area_extension  suit_announce , absorb(i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_extension if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_6 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep( suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Dept-Year FE, Yes)
	
    reghdfe coca_area_extension  pr_PNIS_announce , absorb(iddeptoy) vce(cluster muni_code)
		local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
		sum coca_area_extension if e(sample) == 1 & year < 2014, d			
		outreg2 using AppendixTable_6 , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Dept-Year FE, Yes)

    reghdfe coca_area_new  suit_announce , absorb(i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_new if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_6 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep( suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Dept-Year FE, Yes)
	
    reghdfe coca_area_new  pr_PNIS_announce , absorb(iddeptoy) vce(cluster muni_code)
		local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
		sum coca_area_new if e(sample) == 1 & year < 2014, d			
		outreg2 using AppendixTable_6 , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Dept-Year FE, Yes)

		
************
// Table A.7. Heterogeneous effects
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	global het "DALLGroups total_offices_pop ShaptaCacao ShaptaPalma cofint shAUanomALT " 

	foreach h in $het {
		g `h'_A = `h' * announcement
		sum pr_PNIS_announce, d
		g `h'_pr_PNIS_A = `h' * (pr_PNIS_announce)
		g `h'_suit_A = `h' * suit_announce
	}
	
	local replace replace
	foreach h in $het {
		display("**** `h' ****")
		rename `h'_suit_A 	Z1
		rename `h'_A 	Z2
		rename `h'_pr_PNIS_A Z3
		
		label var Z1 "Z $\times$ Suitability $\times$ Announcement"		
		label var Z2 "Z $\times$ Announcement"		
		label var Z3 "Z $\times$ Probability of substitution $\times$ Announcement"		
		
		reghdfe coca_area_grid Z1 suit_announce Z2, absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
			local N = `e(N_clust)'
			sum coca_area_grid if e(sample) == 1 & year < 2014, d			
			outreg2 using AppendixTable_7 , tex(frag) `replace' bdec(2) sdec(2) label ctitle("`h'") nocons keep(Z1 suit_announce Z2) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
			local replace append
			
		xi: xtreg coca_area_grid Z3 pr_PNIS_announce Z2  i.iddeptoy, fe vce(cluster muni_code)
			local N = `e(N_clust)'
			boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
			local se = _b[pr_PNIS_announce]/`r(t)'		
			boottest Z3, boottype(wild) cluster(muni_code) seed(11110) nograph 
			local se1 = _b[Z3]/`r(t)'		
			sum coca_area_grid if e(sample) == 1 & year < 2014, d			
			outreg2 using AppendixTable_7 , tex(frag) `replace' bdec(2) sdec(2) label ctitle("`h'") nocons keep(Z3 pr_PNIS_announce Z2) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se', Boot SE 3int, `se1') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
			local replace append
			
		rename Z1 `h'_suit_A
		rename Z2 `h'_A
		rename Z3 `h'_pr_PNIS_A			
	}
	
************
// Table A.8. Change in violence, coca suitability, and probability of substitution
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	collapse viol_oagv2d_* att_oagv2d_* suitability pr_PNIS indrural discapital IPM lpobl_tot (firstnm) coddepto, by(muni_code)

	label var suitability 		"Suitability"
	label var pr_PNIS 			"Probability of substitution"
	label var viol_oagv2d_13 	"Other armed groups violent events in 2013"
	label var att_oagv2d_13 	"Other armed groups violent events in 2013"
	
	*** Panel A: Any violent event
	reghdfe viol_oagv2d_18 suitability viol_oagv2d_13, abs(coddepto) vce(robust)
		sum viol_oagv2d_18
		outreg2 using AppendixTable_8A, tex(frag) replace keep(suitability viol_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean)) addtext(Department FE, Yes, Controls, No)
		
	reghdfe viol_oagv2d_18 suitability viol_oagv2d_13 indrural discapital IPM lpobl_tot, abs(coddepto) vce(robust)	
		sum viol_oagv2d_18
		outreg2 using AppendixTable_8A, tex(frag) append keep(suitability viol_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean)) addtext(Department FE, Yes, Controls, Yes)
	
	areg viol_oagv2d_18 pr_PNIS viol_oagv2d_13 , abs(coddepto) vce(robust)
		boottest pr_PNIS, boottype(wild) seed(11110)  nograph
		local se = _b[pr_PNIS]/`r(t)'		
		sum viol_oagv2d_18
		outreg2 using AppendixTable_8A, tex(frag) append keep(pr_PNIS viol_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean), Boot SE, `se') addtext(Department FE, Yes, Controls, No)

	areg viol_oagv2d_18 pr_PNIS viol_oagv2d_13 indrural discapital IPM lpobl_tot, abs(coddepto) vce(robust)
		boottest pr_PNIS, boottype(wild) seed(11110)  nograph
		local se = _b[pr_PNIS]/`r(t)'		
		sum viol_oagv2d_18
		outreg2 using AppendixTable_8A, tex(frag) append keep(pr_PNIS viol_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean), Boot SE, `se') addtext(Department FE, Yes, Controls, Yes)
	
	*** Panel B: Any attack
	reghdfe att_oagv2d_18 suitability att_oagv2d_13 , abs(coddepto) vce(robust)
		sum att_oagv2d_18
		outreg2 using AppendixTable_8B, tex(frag) replace keep(suitability att_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean)) addtext(Department FE, Yes, Controls, No)
		
	reghdfe att_oagv2d_18 suitability att_oagv2d_13 indrural discapital IPM lpobl_tot, abs(coddepto) vce(robust)	
		sum att_oagv2d_18
		outreg2 using AppendixTable_8B, tex(frag) append keep(suitability att_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean)) addtext(Department FE, Yes, Controls, Yes)
	
	areg att_oagv2d_18 pr_PNIS att_oagv2d_13, abs(coddepto) vce(robust)
		boottest pr_PNIS, boottype(wild) seed(11110)  nograph
		local se = _b[pr_PNIS]/`r(t)'		
		sum att_oagv2d_18
		outreg2 using AppendixTable_8B, tex(frag) append keep(pr_PNIS att_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean), Boot SE, `se') addtext(Department FE, Yes, Controls, No)

	areg att_oagv2d_18 pr_PNIS att_oagv2d_13 indrural discapital IPM lpobl_tot, abs(coddepto) vce(robust)
		boottest pr_PNIS, boottype(wild) seed(11110)  nograph
		local se = _b[pr_PNIS]/`r(t)'		
		sum att_oagv2d_18
		outreg2 using AppendixTable_8B, tex(frag) append keep(pr_PNIS att_oagv2d_13) bdec(2) sdec(2) label nocons adds(Mean DV, r(mean), Boot SE, `se') addtext(Department FE, Yes, Controls, Yes)
	
	
************
// Table A.9. PNIS implementation
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	label var PNISvinc_post 	"PNIS × Implementation"
	label var PNISass_post 		"PNIS × Implementation"
	label var suit_announce 	"Suitability × Announcement"
	label var pr_PNIS_announce 	"Probability of substitution × Announcement"
	
	rename PNISvinc_post PNIS_T
	reghdfe coca_area_grid PNIS_T suit_announce , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_9 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(PNIS_T suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	xi: xtreg coca_area_grid PNIS_T pr_PNIS_announce  i.iddeptoy , fe vce(cluster muni_code)
		local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
		sum coca_area_grid if e(sample) == 1 & year < 2014, d			
		outreg2 using AppendixTable_9 , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep(PNIS_T pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	rename PNIS_T PNISvinc_post 

	rename PNISass_post PNIS_T
    reghdfe coca_area_grid PNIS_T suit_announce , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_area_grid if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_9 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(PNIS_T suit_announce pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	
	xi: xtreg coca_area_grid PNIS_T pr_PNIS_announce  i.iddeptoy , fe vce(cluster muni_code)
		local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110) nograph 
		local se = _b[pr_PNIS_announce]/`r(t)'		
		sum coca_area_grid if e(sample) == 1 & year < 2014, d			
		outreg2 using AppendixTable_9 , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep(PNIS_T pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Dept-Year FE, Yes)
	rename PNIS_T PNISass_post 
	
************
// Table A.10. Land restitution
************
	* Load dataset
	use "${Data}MainData.dta", clear

	collapse (max) pr_PNIS suitability applications properties propietaries  ///
			indrural discapital IPM lpobl_tot app_pc rural_pc pop_pc (firstnm) coddepto, by(muni_code)
	rename coddepto depto		
	
	label var suitability 	"Suitability"
	label var pr_PNIS 		"Probability of substitution"

	** Panel A: Levels
		reghdfe applications  suitability indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			sum applications if e(sample) == 1, d			
			outreg2 using AppendixTable_10A , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(  suitability) adds(Mean DV, r(mean), SD DV, r(sd)) addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe applications  pr_PNIS indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			boottest pr_PNIS, boottype(wild) seed(11110) nograph 
			local se = _b[pr_PNIS]/`r(t)'		
			sum applications if e(sample) == 1, d			
			outreg2 using AppendixTable_10A , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS) adds( Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe properties  suitability indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			sum properties if e(sample) == 1, d			
			outreg2 using AppendixTable_10A	 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(  suitability) adds(Mean DV, r(mean), SD DV, r(sd)) addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe properties  pr_PNIS indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			boottest pr_PNIS, boottype(wild) seed(11110) nograph 
			local se = _b[pr_PNIS]/`r(t)'		
			sum properties if e(sample) == 1, d			
			outreg2 using AppendixTable_10A , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS) adds(Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe propietaries  suitability indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			sum propietaries if e(sample) == 1, d			
			outreg2 using AppendixTable_10A , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(  suitability) adds(Mean DV, r(mean), SD DV, r(sd)) addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe propietaries  pr_PNIS indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			boottest pr_PNIS, boottype(wild) seed(11110) nograph 
			local se = _b[pr_PNIS]/`r(t)'		
			sum propietaries if e(sample) == 1, d			
			outreg2 using AppendixTable_10A , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS) adds(Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Deptartment FE, Yes, Controls, Yes)
			
		
	** Panel B: Per 1,000 inhabitants
		reghdfe app_pc  suitability indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			sum app_pc if e(sample) == 1, d			
			outreg2 using AppendixTable_10B , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(  suitability) adds(Mean DV, r(mean), SD DV, r(sd)) addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe app_pc  pr_PNIS indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			boottest pr_PNIS, boottype(wild) seed(11110) nograph 
			local se = _b[pr_PNIS]/`r(t)'		
			sum app_pc if e(sample) == 1, d			
			outreg2 using AppendixTable_10B , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS) adds(Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe rural_pc  suitability indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			sum rural_pc if e(sample) == 1, d			
			outreg2 using AppendixTable_10B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(  suitability) adds(Mean DV, r(mean), SD DV, r(sd)) addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe rural_pc  pr_PNIS indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			boottest pr_PNIS, boottype(wild) seed(11110) nograph 
			local se = _b[pr_PNIS]/`r(t)'		
			sum rural_pc if e(sample) == 1, d			
			outreg2 using AppendixTable_10B , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS) adds(Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe pop_pc  suitability indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			sum pop_pc if e(sample) == 1, d			
			outreg2 using AppendixTable_10B , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep( suitability ) adds(Mean DV, r(mean), SD DV, r(sd)) addtext(Deptartment FE, Yes, Controls, Yes)

		reghdfe pop_pc  pr_PNIS indrural discapital IPM lpobl_tot , absorb(depto) vce(robust)
			boottest pr_PNIS, boottype(wild) seed(11110) nograph 
			local se = _b[pr_PNIS]/`r(t)'		
			sum pop_pc if e(sample) == 1, d			
			outreg2 using AppendixTable_10B , tex(frag) append bdec(2) sdec(2) label ctitle("`h'") nocons keep( pr_PNIS) adds(Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Deptartment FE, Yes, Controls, Yes)
	
	
************
// Table A.11. Differential effects by protected areas
************
	* Load dataset
	use "${Data}MainData.dta", clear
	
	label var suit_announce 	"Suitability × Announcement"
	label var pr_PNIS_announce 	"Probability of substitution × Announcement"
	
	reghdfe coca_protect_area suit_announce , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_protect_area if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_11 , tex(frag) replace bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	
    reghdfe coca_No_protect_area suit_announce , absorb(muni_code year i.coddepto#i.year) vce(cluster muni_code)
        local N = `e(N_clust)'
        sum coca_No_protect_area if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_11 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(suit_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd)) addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	
	xtset muni_code year 
	xi: xtreg coca_protect_area pr_PNIS_announce i.iddeptoy, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_protect_area if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_11 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
		
	xi: xtreg coca_No_protect_area pr_PNIS_announce i.iddeptoy, fe vce(cl muni_code)
        local N = `e(N_clust)'
		boottest pr_PNIS_announce, boottype(wild) cluster(muni_code) seed(11110)  nograph
		local se = _b[pr_PNIS_announce]/`r(t)'		
        sum coca_No_protect_area if e(sample) == 1 & year < 2014, d			
        outreg2 using AppendixTable_11 , tex(frag) append bdec(2) sdec(2) label nocons ctitle("`depvar'") keep(pr_PNIS_announce) adds(Municipalities, `N', Mean DV, r(mean), SD DV, r(sd), Boot SE, `se') addtext(Municipality FE, Yes, Year FE, Yes, Dept-Year FE, Yes)
	
